package com.bocaizp.operation.controller.user;

import com.bocaizp.common.result.Result;
import com.bocaizp.operation.service.CompanySerivce;
import com.bocaizp.pojo.DTO.CompanyDTO;
import com.bocaizp.pojo.VO.CompanyShowVO;
import com.bocaizp.pojo.VO.IndustryVO;
import com.bocaizp.pojo.entity.JobData;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Author : huang jie
 * Date : 2024/5/4 22:09
 **/
@RestController
@RequestMapping("/user")
@Slf4j
@CrossOrigin
public class CompanyController {

	@Autowired
	private CompanySerivce companySerivce;

	/**
	 * 获取公司行业
	 * @return
	 */
	@GetMapping("/getindustry")
	private Result<List<IndustryVO>> getIndustry(){
		log.info("获取公司行业请求...");
		List<IndustryVO> industryVOS = companySerivce.getindustry();
		return Result.success(industryVOS);
	}

	/**
	 * 获取公司列表
	 * @param companyDTO
	 * @return
	 */
	@PostMapping("/getcompany")
	public Result<List<CompanyShowVO>> getCompany(@RequestBody CompanyDTO companyDTO){
		log.info("获取公司列表...");
		System.out.println(companyDTO);
		Long start = System.currentTimeMillis();
		List<CompanyShowVO> companyShowVOS = companySerivce.getcompany(companyDTO);
		Long end = System.currentTimeMillis();
		System.out.println("公司请求时间：" + (end - start) + "毫秒");

		return Result.success(companyShowVOS);
	}
}
